package org.xukai.remoting.sdk.rpc.transfer;

import com.dtdream.emr.transmission.exception.TransmissionException;

import static com.dtdream.emr.transmission.exception.TransmissionException.Error.EXCEPTION_SDK_CONFIG;

public class NettyConfig {
    private int eventLoopThreads;
    private int waterMark;

    public NettyConfig() {
    }

    public int getEventLoopThreads() {
        return eventLoopThreads;
    }

    public void setEventLoopThreads(int eventLoopThreads) {
        this.eventLoopThreads = eventLoopThreads;
    }

    public int getWaterMark() {
        return waterMark;
    }

    public void setWaterMark(int waterMark) {
        this.waterMark = waterMark;
    }

    public void assertValid() throws TransmissionException {
        if(eventLoopThreads<=0){
            throw new TransmissionException(EXCEPTION_SDK_CONFIG,"eventLoopThreads can not below  0!");
        }
        if(waterMark<=0){
            throw new TransmissionException(EXCEPTION_SDK_CONFIG,"waterMark can not below 0!");
        }
    }
}
